<?php

class Book_Model_Book extends Core_Model_Item_Abstract {

    //link title to detail book (activity feed)
    public function getHref($params = array()) {
        $params = array_merge(array(
            'route' => 'book_general',
            'reset' => true,
            'action' => 'detailbook',
            'book_id' => $this->book_id
                ), $params);
        $route = $params['route'];
        $reset = $params['reset'];
        unset($params['route']);
        unset($params['reset']);
        return Zend_Controller_Front::getInstance()->getRouter()
                        ->assemble($params, $route, $reset);
    }

    public function comments() {
        return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('comments', 'core'));
    }

    public function likes() {
        return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('likes', 'core'));
    }

    public function tags() {
        return new Engine_ProxyObject($this, Engine_Api::_()->getDbtable('tags', 'core'));
    }

    //display activity feed
    public function getRichContent() {
        //
        echo '<img src="/se483/public/PictureBook/' . $this->image . '" width="70px" height="100px" >';
    }

}
